<!DOCTYPE html>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>gen_dl_model_heatmap [HALCON算子参考手册]</title>
<style type="text/css">
      body {
    color: #000000;
    background-color: #ffffff;
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
}

.body_main {
    margin-left: 35px;
    margin-right: 35px;
}

@media screen and (min-width:992px) {

    .body_main {
        margin-left: 10%;
        margin-right: 10%;
    }

    table.toctable {
        width: 80%
    }
}

@media screen and (min-width:1400px) {

    .body_main {
        margin-left: 15%;
        margin-right: 15%;
    }

    table.toctable {
        width: 70%
    }
}

body>div ul ul {
    margin-left: inherit;
}

a:link {
    color: #0044cc;
}

a:link,
a:visited {
    text-decoration: none;
}

a:link:hover,
a:visited:hover {
    text-decoration: underline;
}

th {
    text-align: left;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    text-rendering: optimizeLegibility;
    color: #666666;
}

code {
    font-family: monospace,monospace;
}

h1 a.halconoperator {
    font-family: Arial, Helvetica, sans-serif;
    color: #666666;
}

h2 a.halconoperator {
    font-family: Arial, Helvetica, sans-serif;
    color: #666666;
}

hr {
    border: 0;
    border-top: solid 1px #f28d26;
}

.pre {
    display: block;
    padding-bottom: 1ex;
    font-family: monospace;
    white-space: pre;
}

pre {
    font-family: monospace, monospace;
    padding: 1ex;
    white-space: pre-wrap;
}

.toc {
    font-size: 80%;
    border-top: 1px dashed #f28d26;
    border-bottom: 1px dashed #f28d26;
    padding-top: 5px;
    padding-bottom: 5px;
}

.inv {
    margin: 0;
    border: 0;
    padding: 0;
}

.banner {
    color: #666666;
    padding-left: 1em;
}

.logo {
    background-color: white;
}

.keyboard {
    font-size: 80%;
    padding-left: 3px;
    padding-right: 3px;
    border-radius: 5px;
    border-width: 1px;
    border-style: solid;
    border-color: #f28d26;
    background-color: #f3f3f3;
}

.warning {
    margin-top: 2ex;
    margin-bottom: 1ex;
    padding: 10px;
    text-align: center;
    border: 1px solid;
    color: #bb0000;
    background-color: #fff7f7
}

.imprint {
    margin-top: 1ex;
    font-size: 80%;
    color: #666666;
}

.imprinthead {
    font-weight: bolder;
    color: #666666;
}

.indexlink {
    text-align: right;
    padding-bottom: 5px;
}

.postscript {
    margin-top: 2ex;
    font-size: 80%;
    color: #666666
}

.evenrow {
    background-color: #e7e7ef;
    vertical-align: top;
}

.oddrow {
    background-color: #f7f7ff;
    vertical-align: top;
}

.headrow {
    background-color: #97979f;
    color: #ffffff;
    vertical-align: top;
}

.logorow {
    vertical-align: top;
}

.error {
    color: red;
}

.var {
    font-style: italic
}

.halconoperator {
    font-family: monospace, monospace;
}

span.operator {
    font-family: monospace, monospace;
}

span.procedure {
    font-family: monospace, monospace;
}

span.operation {
    font-family: monospace, monospace;
}

span.feature {
    font-family: Arial, Helvetica, Homerton, sans-serif;
}

ul {
    padding-left: 1.2em;
}

li.dot {
    list-style-type: square;
    color: #f28d26;
}

.breadcrumb {
    font-size: 80%;
    color: white;
    background-color: #062d64;
    margin-bottom: 20px;
    padding-left: 35px;
    padding-right: 35px;
    padding-bottom: 15px;
}

.webbar {
    font-size: 80%;
    background-color: #dddddd;
    margin-top: 0px;
    margin-left: -35px;
    margin-right: -35px;
    margin-bottom: 0px;
    padding-top: 5px;
    padding-left: 35px;
    padding-right: 35px;
    padding-bottom: 5px;
}

.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    border-top: 1px dashed #f28d26;
    font-size: 80%;
    color: #666666;
    padding-bottom: 8px;
}

.footer .socialmedia a {
    padding-left: 7px;
}

.socialmedia {
    padding-top: 10px;
}

.copyright {
    margin-top: 19px;
}

.breadcrumb a {
    color: #ffffff;
    border-bottom: 1px solid white;
}

.breadcrumb a:link:hover,
.breadcrumb a:visited:hover {
    text-decoration: none;
    border-bottom: none;
}

.heading {
    margin-top: 1ex;
    font-size: 110%;
    font-weight: bold;
    color: #666666;
}

.text {
    color: black;
}

.example {
    font-size: 80%;
    background-color: #f3f3f3;
    border: 1px dashed #666666;
    padding: 10px;
}

.displaymath {
    display: block;
    text-align: center;
    margin-top: 1ex;
    margin-bottom: 1ex;
}

.title {
    float: left;
    padding-top: 3px;
    padding-bottom: 3px;
}

.signnote {
    font-family: Arial, Helvetica, Homerton, sans-serif;
    font-size: 80%;
    color: #666666;
    font-weight: lighter;
    font-style: italic
}

.par {
    margin-bottom: 1.5em;
}

.parhead {
    text-align: right;
}

.parname {
    float: left;
}

.pardesc {
    font-size: 85%;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    margin-left: 2em;
}

.parcat {
    color: #666;
    font-weight: bold;
}

*[data-if=cpp],
*[data-if=c],
*[data-if=dotnet],
*[data-if=com],
*[data-if=python] {
    display: none;
}

.tabbar {
    text-align: right;
    border-bottom: 1px solid #f28d26;
    margin-bottom: 0.5em;
}

ul.tabs {
    padding-top: 3px;
    padding-bottom: 3px;
    margin-top: 10px;
    margin-bottom: 0;
    font-size: 80%
}

ul.tabs li {
    padding-top: 3px;
    padding-bottom: 3px;
    display: inline;
    overflow: hidden;
    list-style-type: none;
    margin: 0;
    margin-left: 8px;
    border-top: 1px solid #666;
    border-left: 1px solid #666;
    border-right: 1px solid #666;
}

ul.tabs li.active {
    border-left: 1px solid #f28d26;
    border-right: 1px solid #f28d26;
    border-top: 1px solid #f28d26;
    border-bottom: 1px solid #fff;
}

ul.tabs li.inactive {
    background-color: #eee;
}

ul.tabs li a {
    padding-left: 5px;
    padding-right: 5px;
    color: #666;
}

ul.tabs li a:link:hover {
    text-decoration: none;
}

ul.tabs li.inactive a {
    color: #666;
}

ul.tabs li.active a {
    color: black;
}

dl.generic dd {
    margin-bottom: 1em;
}

.pari {
    color: olive;
}

.paro {
    color: maroon;
}

.comment {
    font-size: 80%;
    color: green;
    white-space: nowrap;
}

table.grid {
    border-collapse: collapse;
}

table.grid td {
    padding: 5px;
    border: 1px solid;
}

table.layout {
    border: 0px;
}

table.layout td {
    padding: 5px;
}

table.table {
    border-collapse: collapse;
}

table.table td {
    padding: 5px;
    border-left: 0px;
    border-right: 0px;
}

table.table tr:last-child {
    border-bottom: 1px solid;
}

table.table th {
    padding: 5px;
    border-top: 1px solid;
    border-bottom: 1px solid;
    border-left: 0px;
    border-right: 0px;
}

.details_summary {
    cursor: pointer;
}

table.toctable {
    width: 100%;
}

table.toctable col:first-child {
    width: 20%;
}

table.toctable col:nth-last-child(2) {
    width: 8%;
}

table.altcolored tr:nth-child(even) {
    background-color: #f3f3f3;
}

    </style>
<!--OP_REF_STYLE_END-->
<script>
    <!--
var active_lang='hdevelop';function switchVisibility(obj,active_lang,new_lang)
{var display_style='inline';
for(var i=0;i<obj.length;i++)
{if(obj.item(i).getAttribute('data-if')==new_lang)
{obj.item(i).style.display=display_style;}
if(obj.item(i).getAttribute('data-if')==active_lang)
{obj.item(i).style.display='none';}}
return;}
function toggleLanguage(new_lang,initial)
{if(active_lang!=new_lang)
{var lis=document.getElementsByTagName('li');for(var i=0;i<lis.length;i++)
{if(lis.item(i).id=='syn-'+new_lang)
{lis.item(i).className='active';}
else
{lis.item(i).className='inactive';}}
var divs=document.getElementsByTagName('div');var spans=document.getElementsByTagName('span');switchVisibility(divs,active_lang,new_lang);switchVisibility(spans,active_lang,new_lang);if(!initial)
{setCookie("halcon_reference_language",new_lang,null,null);}
active_lang=new_lang;}
return;}
function setCookie(name,value,domain,exp_offset,path,secure)
{localStorage.setItem(name,value);}
function getCookie(name)
{return localStorage.getItem(name);}
function initialize()
{var qs=location.href.split('?')[1];var qs_lang_raw=location.href.split('interface=')[1];var qs_lang;if(qs_lang_raw)
{qs_lang=qs_lang_raw.split('#')[0];}
var cookie_lang=getCookie("halcon_reference_language");var new_lang;if((qs_lang=="hdevelop")||(qs_lang=="dotnet")||(qs_lang=="python")||(qs_lang=="cpp")||(qs_lang=="c"))
{new_lang=qs_lang;setCookie("halcon_reference_language",new_lang,null,null);}
else if((cookie_lang=="hdevelop")||(cookie_lang=="dotnet")||(cookie_lang=="python")||(cookie_lang=="cpp")||(cookie_lang=="c"))
{new_lang=cookie_lang;}
else
{new_lang="hdevelop";}
toggleLanguage(new_lang,1);return;}
-->

  </script>
</head>
<body onload="initialize();">
<div class="breadcrumb">
<br class="inv"><a href="index.html">目录</a> / <a href="toc_deeplearning.html">Deep Learning</a> / <a href="toc_deeplearning_model.html">Model</a><br class="inv">
</div>
<div class="body_main">
<div class="tabbar"><ul class="tabs">
<li id="syn-hdevelop" class="active"><a href="javascript:void(0);" onclick="toggleLanguage('hdevelop')" onfocus="blur()">HDevelop</a></li>
<li id="syn-dotnet" class="inactive"><a href="javascript:void(0);" onclick="toggleLanguage('dotnet')" onfocus="blur()">.NET</a></li>
<li id="syn-python" class="inactive"><a href="javascript:void(0);" onclick="toggleLanguage('python')" onfocus="blur()">Python</a></li>
<li id="syn-cpp" class="inactive"><a href="javascript:void(0);" onclick="toggleLanguage('cpp')" onfocus="blur()">C++</a></li>
<li id="syn-c" class="inactive"><a href="javascript:void(0);" onclick="toggleLanguage('c')" onfocus="blur()">C</a></li>
</ul></div>
<div class="indexlink">
<a href="index_classes.html"><span data-if="dotnet" style="display:none;">类别</span><span data-if="cpp" style="display:none;">类别</span></a><span data-if="dotnet" style="display:none;"> | </span><span data-if="cpp" style="display:none;"> | </span><a href="index_by_name.html">算子列表</a>
</div>
<!--OP_REF_HEADER_END-->
<h1 id="sec_name">
<span data-if="hdevelop" style="display:inline;">gen_dl_model_heatmap</span><span data-if="c" style="display:none;">T_gen_dl_model_heatmap</span><span data-if="cpp" style="display:none;">GenDlModelHeatmap</span><span data-if="dotnet" style="display:none;">GenDlModelHeatmap</span><span data-if="python" style="display:none;">gen_dl_model_heatmap</span> (算子名称)</h1>
<h2>名称</h2>
<p><code><span data-if="hdevelop" style="display:inline;">gen_dl_model_heatmap</span><span data-if="c" style="display:none;">T_gen_dl_model_heatmap</span><span data-if="cpp" style="display:none;">GenDlModelHeatmap</span><span data-if="dotnet" style="display:none;">GenDlModelHeatmap</span><span data-if="python" style="display:none;">gen_dl_model_heatmap</span></code> — Infer the sample and generate a heatmap.</p>
<h2 id="sec_synopsis">参数签名</h2>
<div data-if="hdevelop" style="display:inline;">
<p>
<code><b>gen_dl_model_heatmap</b>( :  : <a href="#DLModelHandle"><i>DLModelHandle</i></a>, <a href="#DLSample"><i>DLSample</i></a>, <a href="#HeatmapMethod"><i>HeatmapMethod</i></a>, <a href="#TargetClasses"><i>TargetClasses</i></a>, <a href="#GenParam"><i>GenParam</i></a> : <a href="#DLResult"><i>DLResult</i></a>)</code></p>
</div>
<div data-if="c" style="display:none;">
<p>
<code>Herror <b>T_gen_dl_model_heatmap</b>(const Htuple <a href="#DLModelHandle"><i>DLModelHandle</i></a>, const Htuple <a href="#DLSample"><i>DLSample</i></a>, const Htuple <a href="#HeatmapMethod"><i>HeatmapMethod</i></a>, const Htuple <a href="#TargetClasses"><i>TargetClasses</i></a>, const Htuple <a href="#GenParam"><i>GenParam</i></a>, Htuple* <a href="#DLResult"><i>DLResult</i></a>)</code></p>
</div>
<div data-if="cpp" style="display:none;">
<p>
<code>void <b>GenDlModelHeatmap</b>(const HTuple&amp; <a href="#DLModelHandle"><i>DLModelHandle</i></a>, const HTuple&amp; <a href="#DLSample"><i>DLSample</i></a>, const HTuple&amp; <a href="#HeatmapMethod"><i>HeatmapMethod</i></a>, const HTuple&amp; <a href="#TargetClasses"><i>TargetClasses</i></a>, const HTuple&amp; <a href="#GenParam"><i>GenParam</i></a>, HTuple* <a href="#DLResult"><i>DLResult</i></a>)</code></p>
<p>
<code>HDictArray <a href="HDlModel.html">HDlModel</a>::<b>GenDlModelHeatmap</b>(const HDictArray&amp; <a href="#DLSample"><i>DLSample</i></a>, const HString&amp; <a href="#HeatmapMethod"><i>HeatmapMethod</i></a>, const HTuple&amp; <a href="#TargetClasses"><i>TargetClasses</i></a>, const HDict&amp; <a href="#GenParam"><i>GenParam</i></a>) const</code></p>
<p>
<code><a href="HDict.html">HDict</a> <a href="HDlModel.html">HDlModel</a>::<b>GenDlModelHeatmap</b>(const HDict&amp; <a href="#DLSample"><i>DLSample</i></a>, const HString&amp; <a href="#HeatmapMethod"><i>HeatmapMethod</i></a>, const HTuple&amp; <a href="#TargetClasses"><i>TargetClasses</i></a>, const HDict&amp; <a href="#GenParam"><i>GenParam</i></a>) const</code></p>
<p>
<code><a href="HDict.html">HDict</a> <a href="HDlModel.html">HDlModel</a>::<b>GenDlModelHeatmap</b>(const HDict&amp; <a href="#DLSample"><i>DLSample</i></a>, const char* <a href="#HeatmapMethod"><i>HeatmapMethod</i></a>, const HTuple&amp; <a href="#TargetClasses"><i>TargetClasses</i></a>, const HDict&amp; <a href="#GenParam"><i>GenParam</i></a>) const</code></p>
<p>
<code><a href="HDict.html">HDict</a> <a href="HDlModel.html">HDlModel</a>::<b>GenDlModelHeatmap</b>(const HDict&amp; <a href="#DLSample"><i>DLSample</i></a>, const wchar_t* <a href="#HeatmapMethod"><i>HeatmapMethod</i></a>, const HTuple&amp; <a href="#TargetClasses"><i>TargetClasses</i></a>, const HDict&amp; <a href="#GenParam"><i>GenParam</i></a>) const  <span class="signnote">
            (
            Windows only)
          </span></code></p>
</div>
<div data-if="com" style="display:none;"></div>
<div data-if="dotnet" style="display:none;">
<p>
<code>static void <a href="HOperatorSet.html">HOperatorSet</a>.<b>GenDlModelHeatmap</b>(<a href="HTuple.html">HTuple</a> <a href="#DLModelHandle"><i>DLModelHandle</i></a>, <a href="HTuple.html">HTuple</a> <a href="#DLSample"><i>DLSample</i></a>, <a href="HTuple.html">HTuple</a> <a href="#HeatmapMethod"><i>heatmapMethod</i></a>, <a href="HTuple.html">HTuple</a> <a href="#TargetClasses"><i>targetClasses</i></a>, <a href="HTuple.html">HTuple</a> <a href="#GenParam"><i>genParam</i></a>, out <a href="HTuple.html">HTuple</a> <a href="#DLResult"><i>DLResult</i></a>)</code></p>
<p>
<code><a href="HDict.html">HDict[]</a> <a href="HDlModel.html">HDlModel</a>.<b>GenDlModelHeatmap</b>(<a href="HDict.html">HDict[]</a> <a href="#DLSample"><i>DLSample</i></a>, string <a href="#HeatmapMethod"><i>heatmapMethod</i></a>, <a href="HTuple.html">HTuple</a> <a href="#TargetClasses"><i>targetClasses</i></a>, <a href="HDict.html">HDict</a> <a href="#GenParam"><i>genParam</i></a>)</code></p>
<p>
<code><a href="HDict.html">HDict</a> <a href="HDlModel.html">HDlModel</a>.<b>GenDlModelHeatmap</b>(<a href="HDict.html">HDict</a> <a href="#DLSample"><i>DLSample</i></a>, string <a href="#HeatmapMethod"><i>heatmapMethod</i></a>, <a href="HTuple.html">HTuple</a> <a href="#TargetClasses"><i>targetClasses</i></a>, <a href="HDict.html">HDict</a> <a href="#GenParam"><i>genParam</i></a>)</code></p>
</div>
<div data-if="python" style="display:none;">
<p>
<code>def <b>gen_dl_model_heatmap</b>(<a href="#DLModelHandle"><i>dlmodel_handle</i></a>: HHandle, <a href="#DLSample"><i>dlsample</i></a>: MaybeSequence[HHandle], <a href="#HeatmapMethod"><i>heatmap_method</i></a>: str, <a href="#TargetClasses"><i>target_classes</i></a>: int, <a href="#GenParam"><i>gen_param</i></a>: HHandle) -&gt; Sequence[HHandle]</code></p>
<p>
<code>def <b>gen_dl_model_heatmap_s</b>(<a href="#DLModelHandle"><i>dlmodel_handle</i></a>: HHandle, <a href="#DLSample"><i>dlsample</i></a>: MaybeSequence[HHandle], <a href="#HeatmapMethod"><i>heatmap_method</i></a>: str, <a href="#TargetClasses"><i>target_classes</i></a>: int, <a href="#GenParam"><i>gen_param</i></a>: HHandle) -&gt; HHandle</code></p>
</div>
<h2 id="sec_description">描述</h2>
<p>该算子 <code><span data-if="hdevelop" style="display:inline">gen_dl_model_heatmap</span><span data-if="c" style="display:none">gen_dl_model_heatmap</span><span data-if="cpp" style="display:none">GenDlModelHeatmap</span><span data-if="com" style="display:none">GenDlModelHeatmap</span><span data-if="dotnet" style="display:none">GenDlModelHeatmap</span><span data-if="python" style="display:none">gen_dl_model_heatmap</span></code> infers the sample given
by <a href="#DLSample"><i><code><span data-if="hdevelop" style="display:inline">DLSample</span><span data-if="c" style="display:none">DLSample</span><span data-if="cpp" style="display:none">DLSample</span><span data-if="com" style="display:none">DLSample</span><span data-if="dotnet" style="display:none">DLSample</span><span data-if="python" style="display:none">dlsample</span></code></i></a> and generates a heatmap for the class specified by
<a href="#TargetClasses"><i><code><span data-if="hdevelop" style="display:inline">TargetClasses</span><span data-if="c" style="display:none">TargetClasses</span><span data-if="cpp" style="display:none">TargetClasses</span><span data-if="com" style="display:none">TargetClasses</span><span data-if="dotnet" style="display:none">targetClasses</span><span data-if="python" style="display:none">target_classes</span></code></i></a>.
<a href="#DLSample"><i><code><span data-if="hdevelop" style="display:inline">DLSample</span><span data-if="c" style="display:none">DLSample</span><span data-if="cpp" style="display:none">DLSample</span><span data-if="com" style="display:none">DLSample</span><span data-if="dotnet" style="display:none">DLSample</span><span data-if="python" style="display:none">dlsample</span></code></i></a> can be a single dictionary or a tuple of dictionaries for
different samples.
To do so, 该算子 uses the deep learning model given by
<a href="#DLModelHandle"><i><code><span data-if="hdevelop" style="display:inline">DLModelHandle</span><span data-if="c" style="display:none">DLModelHandle</span><span data-if="cpp" style="display:none">DLModelHandle</span><span data-if="com" style="display:none">DLModelHandle</span><span data-if="dotnet" style="display:none">DLModelHandle</span><span data-if="python" style="display:none">dlmodel_handle</span></code></i></a>.
The parameter <a href="#HeatmapMethod"><i><code><span data-if="hdevelop" style="display:inline">HeatmapMethod</span><span data-if="c" style="display:none">HeatmapMethod</span><span data-if="cpp" style="display:none">HeatmapMethod</span><span data-if="com" style="display:none">HeatmapMethod</span><span data-if="dotnet" style="display:none">heatmapMethod</span><span data-if="python" style="display:none">heatmap_method</span></code></i></a> determines, which method is used
to calculate the heatmap.
该算子 returns <a href="#DLResult"><i><code><span data-if="hdevelop" style="display:inline">DLResult</span><span data-if="c" style="display:none">DLResult</span><span data-if="cpp" style="display:none">DLResult</span><span data-if="com" style="display:none">DLResult</span><span data-if="dotnet" style="display:none">DLResult</span><span data-if="python" style="display:none">dlresult</span></code></i></a> with a result dictionary for every
given sample.
Note, <a href="#DLResult"><i><code><span data-if="hdevelop" style="display:inline">DLResult</span><span data-if="c" style="display:none">DLResult</span><span data-if="cpp" style="display:none">DLResult</span><span data-if="com" style="display:none">DLResult</span><span data-if="dotnet" style="display:none">DLResult</span><span data-if="python" style="display:none">dlresult</span></code></i></a> will be newly created
and already existing parameters with this name will be overwritten.
</p>
<p>A heatmap can be useful to analyze which parts of an image have a strong
influence for the inference into a certain class.
Shape and area of these parts and therewith the heatmaps may vary widely
for differing networks especially if their architectures differ.
There are different methods how a heatmap is calculated.
The following ones can be selected using <a href="#HeatmapMethod"><i><code><span data-if="hdevelop" style="display:inline">HeatmapMethod</span><span data-if="c" style="display:none">HeatmapMethod</span><span data-if="cpp" style="display:none">HeatmapMethod</span><span data-if="com" style="display:none">HeatmapMethod</span><span data-if="dotnet" style="display:none">heatmapMethod</span><span data-if="python" style="display:none">heatmap_method</span></code></i></a>:
</p>
<dl class="generic">

<dt><b><i><span data-if="hdevelop" style="display:inline">'grad_cam'</span><span data-if="c" style="display:none">"grad_cam"</span><span data-if="cpp" style="display:none">"grad_cam"</span><span data-if="com" style="display:none">"grad_cam"</span><span data-if="dotnet" style="display:none">"grad_cam"</span><span data-if="python" style="display:none">"grad_cam"</span></i>:</b></dt>
<dd><p>
 Provides region-based heatmap information based on
Gradient-weighted Class Activation Mapping (Grad-CAM).
For a more detailed description refer to the referenced paper below.
</p></dd>

<dt><b><i><span data-if="hdevelop" style="display:inline">'guided_grad_cam'</span><span data-if="c" style="display:none">"guided_grad_cam"</span><span data-if="cpp" style="display:none">"guided_grad_cam"</span><span data-if="com" style="display:none">"guided_grad_cam"</span><span data-if="dotnet" style="display:none">"guided_grad_cam"</span><span data-if="python" style="display:none">"guided_grad_cam"</span></i>:</b></dt>
<dd><p>
 Provides pixel-based heatmap information
based on Guided gradient-weighted Class Activation
Mapping (Guided Grad-CAM).
For a more detailed description refer to the referenced paper below.
</p></dd>
</dl>
<p>The input parameter <a href="#TargetClasses"><i><code><span data-if="hdevelop" style="display:inline">TargetClasses</span><span data-if="c" style="display:none">TargetClasses</span><span data-if="cpp" style="display:none">TargetClasses</span><span data-if="com" style="display:none">TargetClasses</span><span data-if="dotnet" style="display:none">targetClasses</span><span data-if="python" style="display:none">target_classes</span></code></i></a> determines the target class, the
class for which the heatmap is generated.
As value the class ID has to be set.
Alternatively, an empty tuple can be handed over. In this case, the heatmap
is calculated for the class with the highest confidence value, thus the
top inferred class.
Currently, <a href="#TargetClasses"><i><code><span data-if="hdevelop" style="display:inline">TargetClasses</span><span data-if="c" style="display:none">TargetClasses</span><span data-if="cpp" style="display:none">TargetClasses</span><span data-if="com" style="display:none">TargetClasses</span><span data-if="dotnet" style="display:none">targetClasses</span><span data-if="python" style="display:none">target_classes</span></code></i></a> only supports a single value or an
empty tuple.
</p>
<p>The following entries can be set in the dictionary <a href="#GenParam"><i><code><span data-if="hdevelop" style="display:inline">GenParam</span><span data-if="c" style="display:none">GenParam</span><span data-if="cpp" style="display:none">GenParam</span><span data-if="com" style="display:none">GenParam</span><span data-if="dotnet" style="display:none">genParam</span><span data-if="python" style="display:none">gen_param</span></code></i></a>:
</p>
<dl class="generic">

<dt><b><code>target_conv_layer</code>:</b></dt>
<dd><p>

Specifies the convolution layer whose activation and gradient are
used for the heatmap.
The convolution layer can be specified using its <code>NAME</code>,
as returned using <i><span data-if="hdevelop" style="display:inline">'summary'</span><span data-if="c" style="display:none">"summary"</span><span data-if="cpp" style="display:none">"summary"</span><span data-if="com" style="display:none">"summary"</span><span data-if="dotnet" style="display:none">"summary"</span><span data-if="python" style="display:none">"summary"</span></i> in <a href="get_dl_model_param.html"><code><span data-if="hdevelop" style="display:inline">get_dl_model_param</span><span data-if="c" style="display:none">get_dl_model_param</span><span data-if="cpp" style="display:none">GetDlModelParam</span><span data-if="com" style="display:none">GetDlModelParam</span><span data-if="dotnet" style="display:none">GetDlModelParam</span><span data-if="python" style="display:none">get_dl_model_param</span></code></a>,
e.g., <i><span data-if="hdevelop" style="display:inline">'conv10'</span><span data-if="c" style="display:none">"conv10"</span><span data-if="cpp" style="display:none">"conv10"</span><span data-if="com" style="display:none">"conv10"</span><span data-if="dotnet" style="display:none">"conv10"</span><span data-if="python" style="display:none">"conv10"</span></i>.
As default, the last (deepest) convolution layer of the network with a
non-trivial activation (width and height not equal to 1) is used.
As a general rule, the activation of the deepest convolution layer
is most suitable for calculating the heatmap, therefore it is
recommended to keep the default layer.
</p></dd>

<dt><b><code>use_conv_only</code>:</b></dt>
<dd>
<p>

In case the convolution layer (selected with <code>target_conv_layer</code>)
is fused with a directly following ReLU activation layer, this parameter can
be used to determine, from which of these layers the activation and gradient
will be used for the heatmap. The following values are supported:
</p>
<dl class="generic">

<dt><b></b></dt>
<dd><p>
 <i><span data-if="hdevelop" style="display:inline">'true'</span><span data-if="c" style="display:none">"true"</span><span data-if="cpp" style="display:none">"true"</span><span data-if="com" style="display:none">"true"</span><span data-if="dotnet" style="display:none">"true"</span><span data-if="python" style="display:none">"true"</span></i>: convolution layer
</p></dd>

<dt><b></b></dt>
<dd><p>
 <i><span data-if="hdevelop" style="display:inline">'false'</span><span data-if="c" style="display:none">"false"</span><span data-if="cpp" style="display:none">"false"</span><span data-if="com" style="display:none">"false"</span><span data-if="dotnet" style="display:none">"false"</span><span data-if="python" style="display:none">"false"</span></i>: ReLU layer
</p></dd>
</dl>
<p>
<i>Restriction:</i> Only applicable if <a href="#HeatmapMethod"><i><code><span data-if="hdevelop" style="display:inline">HeatmapMethod</span><span data-if="c" style="display:none">HeatmapMethod</span><span data-if="cpp" style="display:none">HeatmapMethod</span><span data-if="com" style="display:none">HeatmapMethod</span><span data-if="dotnet" style="display:none">heatmapMethod</span><span data-if="python" style="display:none">heatmap_method</span></code></i></a> is set to
<i><span data-if="hdevelop" style="display:inline">'grad_cam'</span><span data-if="c" style="display:none">"grad_cam"</span><span data-if="cpp" style="display:none">"grad_cam"</span><span data-if="com" style="display:none">"grad_cam"</span><span data-if="dotnet" style="display:none">"grad_cam"</span><span data-if="python" style="display:none">"grad_cam"</span></i>.</p>
<p>
<i>Default:</i> <code>use_conv_only</code> = <i><span data-if="hdevelop" style="display:inline">'true'</span><span data-if="c" style="display:none">"true"</span><span data-if="cpp" style="display:none">"true"</span><span data-if="com" style="display:none">"true"</span><span data-if="dotnet" style="display:none">"true"</span><span data-if="python" style="display:none">"true"</span></i>.
</p>
</dd>

<dt><b><code>scaling</code>:</b></dt>
<dd>
<p>

Sets the scaling method for the heatmap. The following values are supported:
</p>
<dl class="generic">

<dt><b></b></dt>
<dd><p>
 <i><span data-if="hdevelop" style="display:inline">'scale_after_relu'</span><span data-if="c" style="display:none">"scale_after_relu"</span><span data-if="cpp" style="display:none">"scale_after_relu"</span><span data-if="com" style="display:none">"scale_after_relu"</span><span data-if="dotnet" style="display:none">"scale_after_relu"</span><span data-if="python" style="display:none">"scale_after_relu"</span></i>: Negative
values of the heatmap are set to 0 and then all values are
scaled within the range [0,1].
As a consequence, areas within the heatmap can attain very high
values close to 1 although their contribution to the classification
result might be small.
</p></dd>

<dt><b></b></dt>
<dd><p>
 <i><span data-if="hdevelop" style="display:inline">'scale_before_relu'</span><span data-if="c" style="display:none">"scale_before_relu"</span><span data-if="cpp" style="display:none">"scale_before_relu"</span><span data-if="com" style="display:none">"scale_before_relu"</span><span data-if="dotnet" style="display:none">"scale_before_relu"</span><span data-if="python" style="display:none">"scale_before_relu"</span></i>: All values of the heatmap
are divided by the maximum absolute value and then negative values
are set to 0. This leads to values for the heatmap in
[0,1]. However, areas of less activation (and hence with a small
contribution to the classification result) may not tend to attain
values near 1.
</p></dd>

<dt><b></b></dt>
<dd><p>
 <i><span data-if="hdevelop" style="display:inline">'none'</span><span data-if="c" style="display:none">"none"</span><span data-if="cpp" style="display:none">"none"</span><span data-if="com" style="display:none">"none"</span><span data-if="dotnet" style="display:none">"none"</span><span data-if="python" style="display:none">"none"</span></i>: The heatmap values are not scaled.
</p></dd>
</dl>
<p>
<i>Restriction:</i> Only applicable if <a href="#HeatmapMethod"><i><code><span data-if="hdevelop" style="display:inline">HeatmapMethod</span><span data-if="c" style="display:none">HeatmapMethod</span><span data-if="cpp" style="display:none">HeatmapMethod</span><span data-if="com" style="display:none">HeatmapMethod</span><span data-if="dotnet" style="display:none">heatmapMethod</span><span data-if="python" style="display:none">heatmap_method</span></code></i></a> is set to
<i><span data-if="hdevelop" style="display:inline">'grad_cam'</span><span data-if="c" style="display:none">"grad_cam"</span><span data-if="cpp" style="display:none">"grad_cam"</span><span data-if="com" style="display:none">"grad_cam"</span><span data-if="dotnet" style="display:none">"grad_cam"</span><span data-if="python" style="display:none">"grad_cam"</span></i>.</p>
<p>
<i>Default:</i> <code>scaling</code> = <i><span data-if="hdevelop" style="display:inline">'scale_after_relu'</span><span data-if="c" style="display:none">"scale_after_relu"</span><span data-if="cpp" style="display:none">"scale_after_relu"</span><span data-if="com" style="display:none">"scale_after_relu"</span><span data-if="dotnet" style="display:none">"scale_after_relu"</span><span data-if="python" style="display:none">"scale_after_relu"</span></i>.
</p>
</dd>
</dl>
<p>Every output dictionary in <a href="#DLResult"><i><code><span data-if="hdevelop" style="display:inline">DLResult</span><span data-if="c" style="display:none">DLResult</span><span data-if="cpp" style="display:none">DLResult</span><span data-if="com" style="display:none">DLResult</span><span data-if="dotnet" style="display:none">DLResult</span><span data-if="python" style="display:none">dlresult</span></code></i></a> contains the inference results
as obtained using <a href="apply_dl_model.html"><code><span data-if="hdevelop" style="display:inline">apply_dl_model</span><span data-if="c" style="display:none">apply_dl_model</span><span data-if="cpp" style="display:none">ApplyDlModel</span><span data-if="com" style="display:none">ApplyDlModel</span><span data-if="dotnet" style="display:none">ApplyDlModel</span><span data-if="python" style="display:none">apply_dl_model</span></code></a>.
Additionally it includes a nested dictionary under the key
<code>heatmap_method</code>, where <code>method</code> is the name of the
specified method as given in <a href="#HeatmapMethod"><i><code><span data-if="hdevelop" style="display:inline">HeatmapMethod</span><span data-if="c" style="display:none">HeatmapMethod</span><span data-if="cpp" style="display:none">HeatmapMethod</span><span data-if="com" style="display:none">HeatmapMethod</span><span data-if="dotnet" style="display:none">heatmapMethod</span><span data-if="python" style="display:none">heatmap_method</span></code></i></a>.
In this nested dictionary the heatmap is saved under the key
<code>heatmap_image_class_classID</code>, in case of <i><span data-if="hdevelop" style="display:inline">'guided_grad_cam'</span><span data-if="c" style="display:none">"guided_grad_cam"</span><span data-if="cpp" style="display:none">"guided_grad_cam"</span><span data-if="com" style="display:none">"guided_grad_cam"</span><span data-if="dotnet" style="display:none">"guided_grad_cam"</span><span data-if="python" style="display:none">"guided_grad_cam"</span></i>
the key is <code>guided_grad_cam_image_class_classID</code>,
where <code>classID</code> is the ID of the target class.
</p>
<h2 id="sec_attention">注意</h2>
<p>System requirements:
This operator performs a backward pass. As a consequence the same system
requirements apply as for the training of deep-learning-based models.
For further details, please refer to the <code>“Installation Guide”</code>,
paragraph “Requirements for Deep Learning and Deep-Learning-Based Methods”.
</p>
<p>The heatmap should be used as a tool for visualizing and better
understanding classification results. It is not intended as a
segmentation tool.
Moreover, <code><span data-if="hdevelop" style="display:inline">gen_dl_model_heatmap</span><span data-if="c" style="display:none">gen_dl_model_heatmap</span><span data-if="cpp" style="display:none">GenDlModelHeatmap</span><span data-if="com" style="display:none">GenDlModelHeatmap</span><span data-if="dotnet" style="display:none">GenDlModelHeatmap</span><span data-if="python" style="display:none">gen_dl_model_heatmap</span></code> currently only supports models with
<i><span data-if="hdevelop" style="display:inline">'type'</span><span data-if="c" style="display:none">"type"</span><span data-if="cpp" style="display:none">"type"</span><span data-if="com" style="display:none">"type"</span><span data-if="dotnet" style="display:none">"type"</span><span data-if="python" style="display:none">"type"</span></i>=<i><span data-if="hdevelop" style="display:inline">'classification'</span><span data-if="c" style="display:none">"classification"</span><span data-if="cpp" style="display:none">"classification"</span><span data-if="com" style="display:none">"classification"</span><span data-if="dotnet" style="display:none">"classification"</span><span data-if="python" style="display:none">"classification"</span></i>.
</p>
<h2 id="sec_execution">运行信息</h2>
<ul>
  <li>多线程类型:可重入(与非独占操作符并行运行)。</li>
<li>多线程作用域:全局(可以从任何线程调用)。</li>
  <li>未经并行化处理。</li>
</ul>
<h2 id="sec_parameters">参数表</h2>
  <div class="par">
<div class="parhead">
<span id="DLModelHandle" class="parname"><b><code><span data-if="hdevelop" style="display:inline">DLModelHandle</span><span data-if="c" style="display:none">DLModelHandle</span><span data-if="cpp" style="display:none">DLModelHandle</span><span data-if="com" style="display:none">DLModelHandle</span><span data-if="dotnet" style="display:none">DLModelHandle</span><span data-if="python" style="display:none">dlmodel_handle</span></code></b> (input_control)  </span><span>dl_model <code>→</code> <span data-if="dotnet" style="display:none"><a href="HDlModel.html">HDlModel</a>, </span><span data-if="dotnet" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="python" style="display:none">HHandle</span><span data-if="cpp" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="c" style="display:none">Htuple</span><span data-if="hdevelop" style="display:inline"> (handle)</span><span data-if="dotnet" style="display:none"> (<i>IntPtr</i>)</span><span data-if="cpp" style="display:none"> (<i>HHandle</i>)</span><span data-if="c" style="display:none"> (<i>handle</i>)</span></span>
</div>
<p class="pardesc">Handle of a Deep learning model.</p>
</div>
  <div class="par">
<div class="parhead">
<span id="DLSample" class="parname"><b><code><span data-if="hdevelop" style="display:inline">DLSample</span><span data-if="c" style="display:none">DLSample</span><span data-if="cpp" style="display:none">DLSample</span><span data-if="com" style="display:none">DLSample</span><span data-if="dotnet" style="display:none">DLSample</span><span data-if="python" style="display:none">dlsample</span></code></b> (input_control)  </span><span>dict(-array) <code>→</code> <span data-if="dotnet" style="display:none"><a href="HDict.html">HDict</a>, </span><span data-if="dotnet" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="python" style="display:none">MaybeSequence[HHandle]</span><span data-if="cpp" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="c" style="display:none">Htuple</span><span data-if="hdevelop" style="display:inline"> (handle)</span><span data-if="dotnet" style="display:none"> (<i>IntPtr</i>)</span><span data-if="cpp" style="display:none"> (<i>HHandle</i>)</span><span data-if="c" style="display:none"> (<i>handle</i>)</span></span>
</div>
<p class="pardesc">Dictionaries with the sample input data.</p>
</div>
  <div class="par">
<div class="parhead">
<span id="HeatmapMethod" class="parname"><b><code><span data-if="hdevelop" style="display:inline">HeatmapMethod</span><span data-if="c" style="display:none">HeatmapMethod</span><span data-if="cpp" style="display:none">HeatmapMethod</span><span data-if="com" style="display:none">HeatmapMethod</span><span data-if="dotnet" style="display:none">heatmapMethod</span><span data-if="python" style="display:none">heatmap_method</span></code></b> (input_control)  </span><span>string <code>→</code> <span data-if="dotnet" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="python" style="display:none">str</span><span data-if="cpp" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="c" style="display:none">Htuple</span><span data-if="hdevelop" style="display:inline"> (string)</span><span data-if="dotnet" style="display:none"> (<i>string</i>)</span><span data-if="cpp" style="display:none"> (<i>HString</i>)</span><span data-if="c" style="display:none"> (<i>char*</i>)</span></span>
</div>
<p class="pardesc">Method to be used for the heatmap calculation.</p>
<p class="pardesc"><span class="parcat">Default:
      </span>
    <span data-if="hdevelop" style="display:inline">'grad_cam'</span>
    <span data-if="c" style="display:none">"grad_cam"</span>
    <span data-if="cpp" style="display:none">"grad_cam"</span>
    <span data-if="com" style="display:none">"grad_cam"</span>
    <span data-if="dotnet" style="display:none">"grad_cam"</span>
    <span data-if="python" style="display:none">"grad_cam"</span>
</p>
<p class="pardesc"><span class="parcat">List of values:
      </span><span data-if="hdevelop" style="display:inline">'grad_cam'</span><span data-if="c" style="display:none">"grad_cam"</span><span data-if="cpp" style="display:none">"grad_cam"</span><span data-if="com" style="display:none">"grad_cam"</span><span data-if="dotnet" style="display:none">"grad_cam"</span><span data-if="python" style="display:none">"grad_cam"</span>, <span data-if="hdevelop" style="display:inline">'guided_grad_cam'</span><span data-if="c" style="display:none">"guided_grad_cam"</span><span data-if="cpp" style="display:none">"guided_grad_cam"</span><span data-if="com" style="display:none">"guided_grad_cam"</span><span data-if="dotnet" style="display:none">"guided_grad_cam"</span><span data-if="python" style="display:none">"guided_grad_cam"</span></p>
</div>
  <div class="par">
<div class="parhead">
<span id="TargetClasses" class="parname"><b><code><span data-if="hdevelop" style="display:inline">TargetClasses</span><span data-if="c" style="display:none">TargetClasses</span><span data-if="cpp" style="display:none">TargetClasses</span><span data-if="com" style="display:none">TargetClasses</span><span data-if="dotnet" style="display:none">targetClasses</span><span data-if="python" style="display:none">target_classes</span></code></b> (input_control)  </span><span>tuple <code>→</code> <span data-if="dotnet" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="python" style="display:none">int</span><span data-if="cpp" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="c" style="display:none">Htuple</span><span data-if="hdevelop" style="display:inline"> (integer)</span><span data-if="dotnet" style="display:none"> (<i>int</i> / </span><span data-if="dotnet" style="display:none">long)</span><span data-if="cpp" style="display:none"> (<i>Hlong</i>)</span><span data-if="c" style="display:none"> (<i>Hlong</i>)</span></span>
</div>
<p class="pardesc">ID of the target class.</p>
<p class="pardesc"><span class="parcat">Default:
      </span>[]</p>
</div>
  <div class="par">
<div class="parhead">
<span id="GenParam" class="parname"><b><code><span data-if="hdevelop" style="display:inline">GenParam</span><span data-if="c" style="display:none">GenParam</span><span data-if="cpp" style="display:none">GenParam</span><span data-if="com" style="display:none">GenParam</span><span data-if="dotnet" style="display:none">genParam</span><span data-if="python" style="display:none">gen_param</span></code></b> (input_control)  </span><span>dict <code>→</code> <span data-if="dotnet" style="display:none"><a href="HDict.html">HDict</a>, </span><span data-if="dotnet" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="python" style="display:none">HHandle</span><span data-if="cpp" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="c" style="display:none">Htuple</span><span data-if="hdevelop" style="display:inline"> (handle)</span><span data-if="dotnet" style="display:none"> (<i>IntPtr</i>)</span><span data-if="cpp" style="display:none"> (<i>HHandle</i>)</span><span data-if="c" style="display:none"> (<i>handle</i>)</span></span>
</div>
<p class="pardesc">Dictionary for generic parameters.</p>
<p class="pardesc"><span class="parcat">Default:
      </span>[]</p>
</div>
  <div class="par">
<div class="parhead">
<span id="DLResult" class="parname"><b><code><span data-if="hdevelop" style="display:inline">DLResult</span><span data-if="c" style="display:none">DLResult</span><span data-if="cpp" style="display:none">DLResult</span><span data-if="com" style="display:none">DLResult</span><span data-if="dotnet" style="display:none">DLResult</span><span data-if="python" style="display:none">dlresult</span></code></b> (output_control)  </span><span>dict(-array) <code>→</code> <span data-if="dotnet" style="display:none"><a href="HDict.html">HDict</a>, </span><span data-if="dotnet" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="python" style="display:none">Sequence[HHandle]</span><span data-if="cpp" style="display:none"><a href="HTuple.html">HTuple</a></span><span data-if="c" style="display:none">Htuple</span><span data-if="hdevelop" style="display:inline"> (handle)</span><span data-if="dotnet" style="display:none"> (<i>IntPtr</i>)</span><span data-if="cpp" style="display:none"> (<i>HHandle</i>)</span><span data-if="c" style="display:none"> (<i>handle</i>)</span></span>
</div>
<p class="pardesc">Dictionaries with the result data.</p>
</div>
<h2 id="sec_predecessors">可能的前置算子</h2>
<p>
<code><a href="apply_dl_model.html"><span data-if="hdevelop" style="display:inline">apply_dl_model</span><span data-if="c" style="display:none">apply_dl_model</span><span data-if="cpp" style="display:none">ApplyDlModel</span><span data-if="com" style="display:none">ApplyDlModel</span><span data-if="dotnet" style="display:none">ApplyDlModel</span><span data-if="python" style="display:none">apply_dl_model</span></a></code>
</p>
<h2 id="sec_references">References</h2>
<p>

R. R. Selvaraju, M. Cogswell, A. Das, R. Vedantam, D. Parikh, D. Batra:
"Grad-CAM: Visual Explanations from Deep Networks via Gradient-Based
Localization," 2017 IEEE International Conference on Computer Vision (ICCV),
Venice, 2017, pp. 618-626. doi: 10.1109/ICCV.2017.74

</p>
<h2 id="sec_module">模块</h2>
<p>
Deep Learning Inference</p>
<!--OP_REF_FOOTER_START-->
<hr>
<div class="indexlink">
<a href="index_classes.html"><span data-if="dotnet" style="display:none;">类别</span><span data-if="cpp" style="display:none;">类别</span></a><span data-if="dotnet" style="display:none;"> | </span><span data-if="cpp" style="display:none;"> | </span><a href="index_by_name.html">算子列表</a>
</div>
<div class="footer">
<div class="copyright">HALCON算子参考手册 Copyright © 2015-2023 51Halcon</div>
</div>
</div>
</body>
</html>
